VERSION 5.00
Begin VB.Form frmTrackGroundRef 
   BackColor       =   &H00FFFFFF&
   Caption         =   "Select Ground Reference Type"
   ClientHeight    =   1920
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5175
   Icon            =   "frmTrackGroundRef.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   1920
   ScaleWidth      =   5175
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdCancel 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "Cancel"
      Height          =   315
      Left            =   2880
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1440
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdContinue 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Caption         =   "Continue"
      Height          =   315
      Left            =   1080
      MaskColor       =   &H00E0E0E0&
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Reference Type"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   1095
      Left            =   240
      TabIndex        =   0
      Top             =   180
      Width           =   4695
      Begin VB.OptionButton optRefType 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Invoice #"
         Height          =   255
         Index           =   3
         Left            =   3360
         TabIndex        =   3
         Top             =   480
         Width           =   975
      End
      Begin VB.OptionButton optRefType 
         BackColor       =   &H00FFFFFF&
         Caption         =   "P.O. #"
         Height          =   255
         Index           =   2
         Left            =   2040
         TabIndex        =   2
         Top             =   480
         Width           =   855
      End
      Begin VB.OptionButton optRefType 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Reference"
         Height          =   255
         Index           =   1
         Left            =   480
         TabIndex        =   1
         Top             =   480
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmTrackGroundRef"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
    Me.Hide
    frmShip.SetFocus
End Sub

Private Sub cmdContinue_Click()
    Dim i As Integer
    Dim strRefType(4) As String
    Dim strQuery As String
    Dim strAcctNum As String
    Dim rsAcctNum As New ADODB.Recordset
    
    On Error GoTo EH
    g_strErrorLocation = "frmShip:cmdContinue_Click"
    
    strRefType(1) = "ground_reference"
    strRefType(2) = "ground_po"
    strRefType(3) = "ground_invoice"
    
    'Get acct# for query
    If frmShip.cboLocationName(1) = frmSetup.cboName Then
        strAcctNum = frmSetup.f10
    Else
        strQuery = "SELECT f10 FROM Meters WHERE Name = " & SingleQuotes(frmShip.cboLocationName(1))
        rsAcctNum.Open strQuery, g_connFSMSClient, adOpenKeyset, adLockOptimistic
        If Not rsAcctNum.EOF Then
            strAcctNum = rsAcctNum!f10
        End If
        rsAcctNum.Close
    End If
    For i = 1 To 3
        If optRefType(i).Value = True Then
            Call frmShip.TrackItRef(frmShip.grdShipments.Columns(i), strRefType(i), strAcctNum)
        End If
    Next

Release:
    If rsAcctNum.State = adStateOpen Then rsAcctNum.Close
    Set rsAcctNum = Nothing
    Me.Hide

    Exit Sub
EH:
    MsgBox Err.Description, vbCritical, g_strErrorLocation
    Resume Release

End Sub

Private Sub Form_Activate()
    optRefType(1).SetFocus
End Sub

'---------------------------------------------------------------------------------------
' Procedure : Form_KeyDown()
' DateTime  : 2/17/2005
' Purpose   : Enter key pressed sends a TAB to move to next field
'---------------------------------------------------------------------------------------
'
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If Not TypeOf Me.ActiveControl Is CommandButton Then
        If Shift = 0 And KeyCode = 13 Then
            SendKeys "{TAB}"
        End If
    End If
End Sub

Private Sub Form_Load()
    optRefType(1).Value = True
End Sub
